<!DOCTYPE html>
<html>

<head>
    <title>登录-半天妖管理系统</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/css/login.css?v=${constants.getReleaseVersion()}" media="all">
<!--    <link rel="stylesheet" href="${ctxPath}/assets/common/css/loginMobile.css?lginv=${constants.getReleaseVersion()}" media="all">-->
    <script>
        if (window != top)
            top.location.replace(location.href);
    </script>
    <style>
        body{
            background: url(/assets/common/images/bg.png) no-repeat center center;
            background-size: cover;
        }
        .tips{
            width: 15%;
            float: right;
            margin-right: 30px;
            margin-top: 20px;
        }
        ol{list-style-type:none;
            counter-reset:sectioncounter;
            padding-left: 15px;
            /*text-indent: -20px;*/
        }
        /*ol li:before {*/
        /*    content:counter(sectioncounter) "、";*/
        /*    counter-increment:sectioncounter;*/
        /*}*/
        .gx_time{
            color: #999;
            font-weight: 500;
            float: right;
            padding-right: 10px
        }
        /*.div_tip {*/
        /*    position: fixed;*/
        /*    right: 15px;*/
        /*    top: 12px;*/
        /*    z-index: 99*/
        /*}*/
        /*.tip_span{*/
        /*    position: fixed;*/
        /*    right: 28px;*/
        /*    top: 67px;*/
        /*    z-index: 99;*/
        /*    color: #77777780;*/
        /*}*/
        .div_tip{
            cursor: pointer;
        }
        .tip_span{
            cursor: pointer;
        }
        .layui-tab-title li {
            display: inline-block;
            *display: inline;
            *zoom: 1;
            vertical-align: middle;
            font-size: 14px;
            transition: all .2s;
            -webkit-transition: all .2s;
            position: relative;
            line-height: 40px;
            min-width: 150px!important;
            padding: 0 15px;
            text-align: center;
            cursor: pointer;
        }
        .dengL{
            display: -webkit-flex;
            display: flex;
        }
        .flex-item {
            width: 139px;
            height: 100px;
            margin: 10px;
        }
        .flex-item span{
            font-size: 12px;
            margin-bottom: 7px;
        }
        .xiaoyao{
            width: 93%;
            float: right;
            margin-right: 20px;
            margin-top: -18px;
        }
        .erweima{
            float: right;
            width: 98%;
            margin-right: 15px;
            margin-top: -4px
        }
        .btnshop {
            display: inline-block;
            width: 100px;
            height: 38px;
            line-height: 38px;
            padding: 0 18px;
            background-color: #00bdd4;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-bottom: 39px;
        }
        a:hover {
            color: #FFFFFF;
        }
        .layui-tab-brief>.layui-tab-title .layui-this {
            color: #00bdd4;
        }
        .layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after {
            border: none;
            border-radius: 0;
            border-bottom: 2px solid #00bdd4;
        }
        .layui-card-body {
            position: relative;
            padding: 10px 15px;
            line-height: 10px!important;
        }
        .zhuce{
            width: 20px;
            height: 20px;
            cursor: pointer;
            margin-bottom: 3px;
        }
        .layui-layer-title {
            padding: 0 !important;
            height: 42px;
            line-height: 42px;
            border-bottom: 1px solid #eee;
            font-size: 20px !important;
            color: #fbfbfb !important;
            overflow: hidden;
            background-color: #00bdd4 !important;
            border-radius: 2px 2px 0 0;
            text-align: center;
        }
        .layui-layer-content{
           padding-left: 30px
        }
        .layui-layer-content span{
            font-size: 16px;
            line-height: 40px;
        }
        .layui-layer-content text{
            color: #F59A23;
            font-size: 16px;
            line-height: 40px;
        }
        .layui-layer-btn .layui-layer-btn0 {
            border-color: #00bdd4 !important;
            background-color: #00bdd4 !important;
            color: #fff;
        }
    </style>
</head>

<body>
<div class="login-wrapper">
<div id="id" hidden>
    <div style="flex-direction: row">
        <span style="padding-left: 10px" id="update_cont"></span>

        <span class="gx_time"><span id="update_time"></span>更新</span>
    </div>
    <div class="layui-col-sm12" style="padding: 10px 20px;">
        <ol id="tip_ol">
        </ol>
    </div>
</div>

<!--    <div class="login-header">-->
<!--        <img src="${ctxPath}/assets/expand/images/logo.png">${constants.getSystemName()}-->
<!--    </div>-->

<!--    <div class="login-header text-white">-->
<!--        <h4>让组织里的每个成员，长处发挥的淋漓尽致，短处变得无关紧要</h4>-->
<!--    </div>-->

    <div class=" login-body">
<!--        <div class="div_tip" id="tip">-->
<!--            <img src="${ctxPath}/assets/common/images/tips.png" class="tips">-->
<!--            <span  class="tip_span">更新提示</span>-->
<!--        </div>-->

        <div class="layui-card">
<!--            <h1>半天妖管理系统</h1>-->
<!--            <div class="layui-card-header">-->
<!--&lt;!&ndash;                <h2>登录系统</h2>&ndash;&gt;-->
<!--            </div>-->
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">系统登录</li>
                    <li>其他登录</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-card-body layui-form layui-form-pane" lay-filter="loginForm">
                            @if(constants.getTenantOpen()){
                            <div class="layui-form-item">
                                <label class="layui-form-label">租户</label>
                                <div class="layui-input-block">
                                    <select name="tenantCode" id="tenantCode">
                                        <option value="">默认租户</option>
                                    </select>
                                </div>
                            </div>
                            @}
                            <div class="layui-form-item">
                                <label class="layui-form-label">账号</label>
                                <div class="layui-input-block">
                                    <input name="username" id="username" placeholder="请输入帐号" type="text" lay-verify="required" class="layui-input myInput">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">密码</label>
                                <div class="layui-input-block">
                                    <input name="password"  id="password" placeholder="请输入密码" type="password" lay-verify="required" class="layui-input myInput">
                                </div>
                            </div>
                            @if(constants.getKaptchaOpen()){
                            <div class="layui-form-item">
                                <label class="layui-form-label">验证码</label>
                                <div class="layui-input-block">
                                    <div class="layui-row inline-block">
                                        <div class="layui-col-xs7">
                                            <input name="kaptcha" id="kaptcha" type="text" lay-verify="required" placeholder="验证码" class="layui-input">
                                        </div>
                                        <div class="layui-col-xs5" style="padding-left: 10px;">
                                            <img class="login-captcha" src="${ctxPath}/kaptcha">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            @}
                            <!--                <div class="layui-form-item" pane="">-->
                            <!--                    <label class="layui-form-label" lay-tips="">督导</label>-->
                            <!--                    <div class="layui-input-block">-->
                            <!--                        <input type="radio" name="remember" value="on" title="是">-->
                            <!--                        <input type="radio" name="remember" value="off" title="否" checked="">-->
                            <!--                    </div>-->
                            <!--                </div>-->
                            <div class="layui-form-item" style="margin-top: 20px;margin-bottom: 10px;">
                                <button  class="layui-btn layui-btn-fluid" lay-submit id="submit">登 录</button>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-col-xs2" id="register" style="text-align: center">
                                    <img src="${ctxPath}/assets/common/images/zhuce.png" class="zhuce">
                                    <div>
                                        <a href="javascript:;" class="layui-link" >用户注册</a>
                                    </div>
                                </div>
                                <!--                    <a href="javascript:;" class="layui-link pull-right">忘记密码？</a>-->
                                <div class="layui-col-xs3" style="text-align: center">
                                    <a class="layui-link" href="https://open.weixin.qq.com/connect/qrconnect?appid=wx64beda25e2fd5af9&redirect_uri=https%3A%2F%2Fbty-store.imugua.tech%2F&response_type=code&scope=snsapi_login">
                                        <div><img src="${ctxPath}/assets/common/images/weixin.png" class="zhuce"> </div>
                                        扫码登录</a>

                                </div>
                                <!--                    <a class="layui-link" href="https://open.weixin.qq.com/connect/qrconnect?appid=wx64beda25e2fd5af9&redirect_uri=http%3A%2F%2Fliuxing125m.w3.luyouxia.net&response_type=code&scope=snsapi_login">微信扫码登录</a>-->
                            </div>

                            <!--                <img id="wechatQrcode" style="height: 100px;width: 100px; display: none" src="${ctxPath}/pictureUpload/project/ewm.jpg?cache=${constants.getReleaseVersion()}">-->

                            <!--
                            <div class="layui-form-item login-other">
                                <label>第三方登录</label>
                                <a href="${ctxPath}/oauth/render/qq"><i class="layui-icon layui-icon-login-qq"></i></a>
                                <a href="${ctxPath}/oauth/render/gitee"><img style="height: 28px;width: 28px" src="${ctxPath}/assets/expand/images/git.png"></a>
                            </div>
                            -->
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-card-body layui-form layui-form-pane" style="padding:5 30px;">
                            <div class="dengL" style="height: 289px;">
                                <div class="flex-item">
                                    <div style="text-align: center">
                                        <img src="${ctxPath}/assets/common/images/xiaoyao.png" class="xiaoyao">
                                        <span style="padding-right: 30px;">小妖APP下载</span>
                                    </div>
                                   <div style="height: 15px"></div>
                                    <div style="text-align: center">
                                        <img src="${ctxPath}/assets/common/images/gongzhonghao.jpg" class="erweima">
                                        <span style="padding-right: 30px;">关注公众号</span>
                                    </div>

                                </div>
                                <div class="flex-item" style="margin-top: -3px;">
                                    <a href="http://btyjt.c3.fxscm.net/" target="_blank"  class="btnshop">供应链系统</a>
                                    <a href="http://scrm.wuuxiang.com/" target="_blank" class="btnshop">CRM会员系统</a>
                                    <a href="https://cy.wuuxiang.com/cy7center/" target="_blank" class="btnshop">收银后台</a>
                                    <a href="https://e.wuuxiang.com/" target="_blank" class="btnshop">收银后台云端</a>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

<!--    <div class="login-footer">-->
<!--        <p>© 2020 <a href="https://www.stylefeng.cn" target="_blank">版权所有</a></p>-->
<!--    </div>-->
</div>

@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    // 软键盘弹出遮挡input框
    // $('.myInput').on('focus',function () {
    // var _this = this;
    // setTimeout(function () {
    // _this.scrollIntoViewIfNeeded();
    // },200)
    // });






    $("input").blur(function () {
        $("html,body").animate({scrollTop: document.documentElement.clientHeight},500);
    });

    // 背景图上移
    // $(document).ready(function () { $('body').css({'height':$(window).height()})});

    // pc端移动端背景图显示
    function IsPC() {
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                flag = false;
                break;
            }
        }
        return flag;
    }

    var flag = IsPC();
    // if(flag === true){
    //     var linkNode = document.createElement("link");
    //     linkNode.setAttribute("rel","stylesheet");
    //     linkNode.setAttribute("type","text/css");
    //     linkNode.setAttribute("href","${ctxPath}/assets/common/css/login.css?v=${constants.getReleaseVersion()}");
    //     document.head.appendChild(linkNode);
    //     $('body').addClass('step');
    //     $('body').removeClass("Mobile");
    //     console.log("pc端");
    // }else{
    //     var linkNode = document.createElement("link");
    //     linkNode.setAttribute("rel","stylesheet");
    //     linkNode.setAttribute("type","text/css");
    //     linkNode.setAttribute("href","${ctxPath}/assets/common/css/loginMobile.css?v=${constants.getReleaseVersion()}");
    //     document.head.appendChild(linkNode);
    //     $('body').addClass('Mobile');
    //     $('body').removeClass("step");
    //     $('.login-header').hide();
    //    console.log("移动端")
    // }

   function getDevice() {
        const u = navigator.userAgent;
        const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if (isAndroid)
            return 'android';
        if (isiOS)
            return 'ios';
    }


    layui.use(['layer', 'form', 'index', 'ax', 'element'], function () {
        var $ = layui.jquery;
        var $ax = layui.ax;
        var layer = layui.layer;
        var form = layui.form;
        var index = layui.index;
        var element = layui.element;

        //初始化二维码
        /*var ajaxa = new $ax(Feng.ctxPath + "/wxLogin/repayment", function (data) {
        });
        ajaxa.start();*/

        // 图形验证码
        $('.login-captcha').click(function () {
            this.src = this.src + '?t=' + (new Date).getTime();
        });

        var errorMsg = "${tips!}";
        if (errorMsg) {
            // layer.msg(errorMsg, {icon: 5, anim: 6,time: 15000});
            let btnText = errorMsg.indexOf('请注册账号') !=-1 ? '立即注册' : '确定';
            layer.open({
                type: 1
                ,btn: [btnText],
                area: ['400px','250px'],
                btnAlign: 'c',
                title:'友情提示',
                content: errorMsg ,
                yes: function(index, layero){
                    if(btnText == '立即注册'){
                        window.location.href = Feng.ctxPath + '/register';
                    } else {
                        layer.close(index);
                    }
                }
            });

        }
        @if(constants.getTenantOpen()){
            //初始化租户列表
            var ajax = new $ax(Feng.ctxPath + "/tenantInfo/listTenants", function (data) {
                for (var i = 0; i < data.data.length; i++) {
                    var name = data.data[i].name;
                    var code = data.data[i].code;
                    $("#tenantCode").append('<option value="' + code + '">' + name + '</option>');
                }
                form.render();
            }, function (data) {
            });
            ajax.start();
        @}

        //回车登录事件
        $('#password').on('keydown', function (event) {
            if (event.keyCode == 13) {
                $("#submit").trigger("click");
                return false;
            }
        });

        // 版本更新
        $('#tip').on('click', function () {
            layer.open({
                type: 1
                ,btn: ['确定'],
                area: ['350px'],
                btnAlign: 'c',
                title:'版本更新',
                content: $('#id') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
            });
        });

        // // 版本更新
        // var ajax = new $ax(Feng.ctxPath + "/weiXinApi/versionList", function (res) {
        //     // for (var i = 0; i < res.data.length; i++) {
        //     //     $("#tip_ol").append('<li>' + res.data[i].content + '</li>');
        //     // }
        //     if(!res.data.noticeId) return
        //     let lastNotice = layui.data('lastNotice')
        //     let tempContent =  res.data.content.replace(/\n/g,'<br>')
        //
        //     $("#tip_ol").html('<div>' + tempContent + '</div> ')
        //     // $("#update_time").append('<span>' +res.data.createTime + '</span>')
        //     $("#update_time").append('<span>' + (res.data.createTime).substring(0,11) + '</span>')
        //     $('#update_cont').append('<span>'+ res.data.title +'</span>')
        //
        //     if (lastNotice.id != res.data.noticeId || !lastNotice) {
        //         $('#tip').trigger('click')
        //         layui.data('lastNotice', {
        //             key: 'id',
        //             value: res.data.noticeId
        //         })
        //     }
        //     form.render();
        // })
        // ajax.start();


        // $(function () {
        //     if(document.cookie.indexOf("a=55")==-1){
        //         $('#tip').trigger('click')
        //         var t=new Date(new Date().getTime()+1000*60*60*24*30);
        //         document.cookie="a=55; expires="+t.toGMTString();
        //     }else{
        //         // alert("再次打开！");
        //     }
        // })

        //登录操作
        $('#submit').click(function () {
            var ajax = new $ax(Feng.ctxPath + "/login", function (data) {
                Feng.success("登录成功!");
                index.clearTabCache();

                var version = localStorage.getItem("version");
                // alert(version);
                if(version == undefined){
                    version = "2";//首次默认进入新版本
                }
                localStorage.setItem('version',version);
                window.location.href = Feng.ctxPath + "/?version=" + version;

                // window.location.href = Feng.ctxPath + "/";
            }, function (data) {
                layer.msg("登录失败！" + data.responseJSON.message, {icon: 5, anim: 6});
            });
            var remember=$('input:radio:checked').val();
            ajax.set("username", $("#username").val());
            ajax.set("password", $("#password").val());
            ajax.set("remember", remember);
            @if(constants.getTenantOpen()){
                ajax.set("tenantCode", $("#tenantCode").val());
            @}
            @if(constants.getKaptchaOpen()){
                ajax.set("kaptcha", $("#kaptcha").val());
            @}
            ajax.start();
        });




    });
</script>

<script>
    $('#register').click(function () {
        window.location.href = Feng.ctxPath + '/register';
    })



    // setInterval(() => {
    //     let img = $('#wechatQrcode').attr('src')
    //     let src = img.split('?cache')
    //     let newSrc = src[0] + '?cache=' + Date.parse(new Date())
    //     $('#wechatQrcode').attr('src', newSrc)
    // }, 60000)


</script>

<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?0e8c3239c13edae0500332bfee182e6f";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>